# coding: utf-8
from sqlalchemy import Column, String, Table ,DateTime
from sqlalchemy.dialects.mysql import INTEGER, VARCHAR 
from sqlalchemy.ext.declarative import declarative_base
from exts import db
import datetime
from sqlalchemy.orm import relationship, backref



class Active(db.Model):
    __tablename__ = 'active'

    activid = db.Column(db.String(255), primary_key=True, info='活动id')
    activityname = db.Column(db.String(255), info='活动名称')
    activetime = db.Column(db.DateTime, info='活动时间')
    sponsorid = db.Column(db.String(255), info='发起者id\\r\\n')
    sponsorname = db.Column(db.String(255), info='发起者名称')



class Gift(db.Model):
    __tablename__ = 'gift'

    activid = db.Column(db.String(200))
    giftnum = db.Column(db.Integer, info='奖品份数')
    giftname = db.Column(db.String(255))
    giftid = db.Column(db.String(250), primary_key=True, info='礼品id')
    winname = db.Column(db.String(255), info='奖项')
    imagesurl = db.Column(db.String(255), info='奖品图片路径')



class Order(db.Model):
    __tablename__ = 'order'

    giftid = db.Column(db.Integer, primary_key=True, nullable=False, info='唯一名单')
    userid = db.Column(db.Integer, info='用户id')
    giftname = db.Column(db.String(255), info='礼品名称')
    address = db.Column(db.String(255), info='收货地址')
    username = db.Column(db.String(255))
    phone = db.Column(db.String(255))
    luckynum = db.Column(db.Integer, primary_key=True, nullable=False, info='中奖号码')



class SAdmin(db.Model):
    __tablename__ = 's_admin'

    id = db.Column(db.Integer, primary_key=True, info='管理员id')
    username = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='用户名')
    login_pwd = db.Column(db.String(32), nullable=False, server_default=db.FetchedValue(), info='登录密码')
    login_salt = db.Column(db.String(6), nullable=False, server_default=db.FetchedValue(), info='登录密码配合加密字符串')
    mobile = db.Column(db.String(11), nullable=False, server_default=db.FetchedValue(), info='手机号码')
    gender = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='性别（0保密，1女，2男）')
    status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='状态（0正常, 1无效）')
    login_total = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='登录次数')
    login_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='最后登录时间')
    role_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='所属角色组')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SAnswer(db.Model):
    __tablename__ = 's_answer'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    user_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户id')
    name = db.Column(db.String(30), nullable=False, index=True, server_default=db.FetchedValue(), info='联系人')
    tel = db.Column(db.String(20), nullable=False, server_default=db.FetchedValue(), info='联系电话')
    title = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='标题')
    content = db.Column(db.Text, info='详细内容')
    reply = db.Column(db.Text, info='回复内容')
    is_reply = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否已回复（0否, 1是）')
    reply_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='回复时间')
    is_show = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否显示（0不显示, 1显示）')
    access_count = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='访问次数')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SAppCenterNav(db.Model):
    __tablename__ = 's_app_center_nav'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    platform = db.Column(db.String(30), nullable=False, index=True, server_default=db.FetchedValue(), info='所属平台（pc PC网站, h5 H5手机网站, ios 苹果APP, android 安卓APP, alipay 支付宝小程序, weixin 微信小程序, baidu 百度小程序, toutiao 头条小程序, qq QQ小程序）')
    event_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='事件类型（0 WEB页面, 1 内部页面(小程序或APP内部地址), 2 外部小程序(同一个主体下的小程序appid), 3 打开地图, 4 拨打电话）')
    event_value = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='事件值')
    images_url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='图片地址')
    name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='名称')
    desc = db.Column(db.String(18), nullable=False, server_default=db.FetchedValue(), info='描述')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    is_need_login = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否需要登录（0否，1是）')
    sort = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='排序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SAppHomeNav(db.Model):
    __tablename__ = 's_app_home_nav'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    platform = db.Column(db.String(30), nullable=False, index=True, server_default=db.FetchedValue(), info='所属平台（pc PC网站, h5 H5手机网站, ios 苹果APP, android 安卓APP, alipay 支付宝小程序, weixin 微信小程序, baidu 百度小程序, toutiao 头条小程序, qq QQ小程序）')
    event_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='事件类型（0 WEB页面, 1 内部页面(小程序或APP内部地址), 2 外部小程序(同一个主体下的小程序appid), 3 打开地图, 4 拨打电话）')
    event_value = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='事件值')
    images_url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='图片地址')
    name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='名称')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    is_need_login = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否需要登录（0否，1是）')
    bg_color = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='css背景色值')
    sort = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='排序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SArticle(db.Model):
    __tablename__ = 's_article'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    title = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='标题')
    article_category_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='文章分类')
    title_color = db.Column(db.String(7), nullable=False, server_default=db.FetchedValue(), info='标题颜色')
    jump_url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='跳转url地址')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    content = db.Column(db.String, info='内容')
    images = db.Column(db.Text, info='图片数据（一维数组json）')
    images_count = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='图片数量')
    access_count = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='访问次数')
    is_home_recommended = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否首页推荐（0否, 1是）')
    seo_title = db.Column(db.String(100), nullable=False, server_default=db.FetchedValue(), info='SEO标题')
    seo_keywords = db.Column(db.String(130), nullable=False, server_default=db.FetchedValue(), info='SEO关键字')
    seo_desc = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='SEO描述')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SArticleCategory(db.Model):
    __tablename__ = 's_article_category'

    id = db.Column(db.Integer, primary_key=True, info='分类id')
    pid = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='父id')
    name = db.Column(db.String(30), nullable=False, info='名称')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    sort = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='顺序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SAttachment(db.Model):
    __tablename__ = 's_attachment'

    id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    title = db.Column(db.String(160), nullable=False, server_default=db.FetchedValue(), info='名称')
    original = db.Column(db.String(160), nullable=False, server_default=db.FetchedValue(), info='原始名称')
    path_type = db.Column(db.String(80), nullable=False, index=True, server_default=db.FetchedValue(), info='路径标记')
    size = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='大小（单位kb）')
    ext = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='类型（后缀名）')
    type = db.Column(db.String(30), nullable=False, index=True, server_default=db.FetchedValue(), info='类型（file文件, image图片, scrawl涂鸦, video视频, remote远程抓取文件）')
    url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='url路径')
    hash = db.Column(db.Text, info='hash值')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SBrand(db.Model):
    __tablename__ = 's_brand'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    logo = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='logo图标')
    name = db.Column(db.String(30), nullable=False, info='名称')
    website_url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='官网地址')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    sort = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='顺序')
    seo_title = db.Column(db.String(100), nullable=False, server_default=db.FetchedValue(), info='SEO标题')
    seo_keywords = db.Column(db.String(130), nullable=False, server_default=db.FetchedValue(), info='SEO关键字')
    seo_desc = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='SEO描述')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SBrandCategory(db.Model):
    __tablename__ = 's_brand_category'

    id = db.Column(db.Integer, primary_key=True, info='分类id')
    name = db.Column(db.String(30), nullable=False, info='名称')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    sort = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='顺序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SBrandCategoryJoin(db.Model):
    __tablename__ = 's_brand_category_join'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    brand_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='品牌id')
    brand_category_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='分类id')
    add_time = db.Column(db.Integer, server_default=db.FetchedValue(), info='添加时间')



class SCart(db.Model):
    __tablename__ = 's_cart'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    user_id = db.Column(db.Integer, index=True, server_default=db.FetchedValue(), info='用户id')
    goods_id = db.Column(db.Integer, index=True, server_default=db.FetchedValue(), info='商品id')
    title = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='标题')
    images = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='封面图片')
    original_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='原价')
    price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='销售价格')
    stock = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='购买数量')
    spec = db.Column(db.Text, info='规格')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SConfig(db.Model):
    __tablename__ = 's_config'

    id = db.Column(db.Integer, primary_key=True, info='基本设置id')
    value = db.Column(db.Text, info='值')
    name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='名称')
    describe = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='描述')
    error_tips = db.Column(db.String(150), nullable=False, server_default=db.FetchedValue(), info='错误提示')
    type = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='类型（admin后台, home前台）')
    only_tag = db.Column(db.String(60), nullable=False, unique=True, server_default=db.FetchedValue(), info='唯一的标记')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SCustomView(db.Model):
    __tablename__ = 's_custom_view'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    title = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='标题')
    content = db.Column(db.String, info='内容')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    is_header = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否包含头部（0否, 1是）')
    is_footer = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否包含尾部（0否, 1是）')
    is_full_screen = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否满屏（0否, 1是）')
    images = db.Column(db.Text, info='图片数据（一维数组json）')
    images_count = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='图片数量')
    access_count = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='访问次数')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SExpres(db.Model):
    __tablename__ = 's_express'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    pid = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='父id')
    icon = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='icon图标')
    name = db.Column(db.String(30), nullable=False, info='名称')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    sort = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='顺序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SFormTableUserField(db.Model):
    __tablename__ = 's_form_table_user_fields'

    id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='管理员id或用户id')
    user_type = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户类型（0后台管理员, 1用户端）')
    md5_key = db.Column(db.String(32), nullable=False, index=True, server_default=db.FetchedValue(), info='form表格数据唯一key')
    fields = db.Column(db.Text, info='字段数据（json格式存储）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SGood(db.Model):
    __tablename__ = 's_goods'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    brand_id = db.Column(db.Integer, server_default=db.FetchedValue(), info='品牌id')
    site_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='商品类型（跟随站点类型一致[0销售, 1展示, 2自提, 3虚拟销售, 4销售+自提]）')
    title = db.Column(db.String(160), nullable=False, index=True, server_default=db.FetchedValue(), info='标题')
    title_color = db.Column(db.String(7), nullable=False, server_default=db.FetchedValue(), info='标题颜色')
    simple_desc = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='简述')
    model = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='型号')
    place_origin = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='产地（地区省id）')
    inventory = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='库存（所有规格库存总和）')
    inventory_unit = db.Column(db.String(15), nullable=False, server_default=db.FetchedValue(), info='库存单位')
    images = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='封面图片')
    original_price = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='原价（单值:10, 区间:10.00-20.00）一般用于展示使用')
    min_original_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='最低原价')
    max_original_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='最大原价')
    price = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='销售价格（单值:10, 区间:10.00-20.00）一般用于展示使用')
    min_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='最低价格')
    max_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='最高价格')
    give_integral = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='购买赠送积分比例')
    buy_min_number = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='最低起购数量 （默认1）')
    buy_max_number = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='最大购买数量（最大数值 100000000, 小于等于0或空则不限）')
    is_deduction_inventory = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否扣减库存（0否, 1是）')
    is_shelves = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否上架（下架后用户不可见, 0否, 1是）')
    is_home_recommended = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否首页推荐（0否, 1是）')
    content_web = db.Column(db.String, info='电脑端详情内容')
    photo_count = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='相册图片数量')
    sales_count = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='销量')
    access_count = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='访问次数')
    video = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='短视频')
    is_exist_many_spec = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否存在多个规格（0否, 1是）')
    spec_base = db.Column(db.Text, info='规格基础数据')
    fictitious_goods_value = db.Column(db.Text, info='虚拟商品展示数据')
    seo_title = db.Column(db.String(100), nullable=False, server_default=db.FetchedValue(), info='SEO标题')
    seo_keywords = db.Column(db.String(130), nullable=False, server_default=db.FetchedValue(), info='SEO关键字')
    seo_desc = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='SEO描述')
    is_delete_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否已删除（0 未删除, 大于0则是删除时间）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SGoodsBrowse(db.Model):
    __tablename__ = 's_goods_browse'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='商品id')
    user_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户id')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SGoodsCategory(db.Model):
    __tablename__ = 's_goods_category'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    pid = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='父id')
    icon = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='icon图标')
    name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='名称')
    vice_name = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='副标题')
    describe = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='描述')
    bg_color = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='css背景色值')
    big_images = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='大图片')
    is_home_recommended = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否首页推荐（0否, 1是）')
    sort = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='排序')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    seo_title = db.Column(db.String(100), nullable=False, server_default=db.FetchedValue(), info='SEO标题')
    seo_keywords = db.Column(db.String(130), nullable=False, server_default=db.FetchedValue(), info='SEO关键字')
    seo_desc = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='SEO描述')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SGoodsCategoryJoin(db.Model):
    __tablename__ = 's_goods_category_join'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    category_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='分类id')
    add_time = db.Column(db.Integer, server_default=db.FetchedValue(), info='添加时间')



class SGoodsComment(db.Model):
    __tablename__ = 's_goods_comments'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='业务订单id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    business_type = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='业务类型名称（如订单 order）')
    content = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='评价内容')
    images = db.Column(db.Text, info='图片数据（一维数组json）')
    reply = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='回复内容')
    rating = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='评价级别（默认0 1~5）')
    is_show = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否显示（0否, 1是）')
    is_anonymous = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否匿名（0否，1是）')
    is_reply = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否回复（0否，1是）')
    reply_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='回复时间')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SGoodsContentApp(db.Model):
    __tablename__ = 's_goods_content_app'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    images = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='图片')
    content = db.Column(db.Text, info='内容')
    sort = db.Column(db.Integer, index=True, server_default=db.FetchedValue(), info='顺序')
    add_time = db.Column(db.Integer, server_default=db.FetchedValue(), info='添加时间')



class SGoodsFavor(db.Model):
    __tablename__ = 's_goods_favor'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='商品id')
    user_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户id')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SGoodsParam(db.Model):
    __tablename__ = 's_goods_params'

    id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    type = db.Column(db.Integer, index=True, server_default=db.FetchedValue(), info='展示范围（0全部, 1详情, 2基础）默认1详情')
    name = db.Column(db.String(180), nullable=False, server_default=db.FetchedValue(), info='参数名称')
    value = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='参数值')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SGoodsPhoto(db.Model):
    __tablename__ = 's_goods_photo'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    images = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='图片')
    is_show = db.Column(db.Integer, index=True, server_default=db.FetchedValue(), info='是否显示（0否, 1是）')
    sort = db.Column(db.Integer, index=True, server_default=db.FetchedValue(), info='顺序')
    add_time = db.Column(db.Integer, server_default=db.FetchedValue(), info='添加时间')



class SGoodsSpecBase(db.Model):
    __tablename__ = 's_goods_spec_base'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='销售价格')
    inventory = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='库存')
    weight = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='重量（kg） ')
    coding = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='编码')
    barcode = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='条形码')
    original_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='原价')
    extends = db.Column(db.String, info='扩展数据(json格式存储)')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SGoodsSpecType(db.Model):
    __tablename__ = 's_goods_spec_type'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    value = db.Column(db.Text, nullable=False, info='类型值（json字符串存储）')
    name = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='类型名称')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SGoodsSpecValue(db.Model):
    __tablename__ = 's_goods_spec_value'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    goods_spec_base_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品规格基础id')
    value = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='规格值')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SLink(db.Model):
    __tablename__ = 's_link'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    name = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='导航名称')
    url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='url地址')
    describe = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='描述')
    sort = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='排序')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    is_new_window_open = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否新窗口打开（0否，1是）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SMessage(db.Model):
    __tablename__ = 's_message'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    title = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='标题')
    detail = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='详情')
    business_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='业务id')
    business_type = db.Column(db.String(180), nullable=False, server_default=db.FetchedValue(), info='业务类型，字符串（如：订单、充值、提现、等...）')
    type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='消息类型（0普通通知, ...）')
    is_read = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否已读（0否, 1是）')
    is_delete_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否已删除（0否, 大于0删除时间）')
    user_is_delete_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户是否已删除（0否, 大于0删除时间）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SNavigation(db.Model):
    __tablename__ = 's_navigation'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    pid = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='父id')
    name = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='导航名称')
    url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='自定义url地址')
    value = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='数据 id')
    data_type = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='数据类型（custom:自定义导航, article_class:文章分类, customview:自定义页面）')
    nav_type = db.Column(db.String(30), nullable=False, index=True, server_default=db.FetchedValue(), info='导航类型（header:顶部导航, footer:底部导航）')
    sort = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='排序')
    is_show = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否显示（0否，1是）')
    is_new_window_open = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否新窗口打开（0否，1是）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SOrder(db.Model):
    __tablename__ = 's_order'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    order_no = db.Column(db.String(60), nullable=False, unique=True, server_default=db.FetchedValue(), info='订单号')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    warehouse_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='仓库id')
    user_note = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='用户备注')
    express_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='快递id')
    express_number = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='快递单号')
    payment_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='支付方式id')
    status = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单状态（0待确认, 1已确认/待支付, 2已支付/待发货, 3已发货/待收货, 4已完成, 5已取消, 6已关闭）')
    pay_status = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='支付状态（0未支付, 1已支付, 2已退款, 3部分退款）')
    extension_data = db.Column(db.String, info='扩展展示数据')
    buy_number_count = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='购买商品总数量')
    increase_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='增加的金额')
    preferential_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='优惠金额')
    price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='订单单价')
    total_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='订单总价(订单最终价格)')
    pay_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='已支付金额')
    refund_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='退款金额')
    returned_quantity = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='退货数量')
    client_type = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='客户端类型（pc, h5, ios, android, alipay, weixin, baidu）取APPLICATION_CLIENT_TYPE常量值')
    order_model = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='订单模式（0销售型, 1展示型, 2自提点, 3虚拟销售）')
    is_under_line = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否线下支付（0否，1是）')
    pay_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='支付时间')
    confirm_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='确认时间')
    delivery_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='发货时间')
    cancel_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='取消时间')
    collect_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='收货时间')
    close_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='关闭时间')
    comments_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='评论时间')
    is_comments = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='商家是否已评论（0否, 大于0评论时间）')
    user_is_comments = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户是否已评论（0否, 大于0评论时间）')
    is_delete_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='商家是否已删除（0否, 大于0删除时间）')
    user_is_delete_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户是否已删除（0否, 大于0删除时间）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SOrderAddres(db.Model):
    __tablename__ = 's_order_address'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    address_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='收件地址id')
    alias = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='别名')
    name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='收件人-姓名')
    tel = db.Column(db.String(15), nullable=False, server_default=db.FetchedValue(), info='收件人-电话')
    province = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='收件人-省')
    city = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='收件人-市')
    county = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='收件人-县/区')
    address = db.Column(db.String(200), nullable=False, server_default=db.FetchedValue(), info='收件人-详细地址')
    province_name = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='收件人-省-名称')
    city_name = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='收件人-市-名称')
    county_name = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='收件人-县/区-名称')
    lng = db.Column(db.Numeric(13, 10), nullable=False, server_default=db.FetchedValue(), info='收货地址-经度')
    lat = db.Column(db.Numeric(13, 10), nullable=False, server_default=db.FetchedValue(), info='收货地址-纬度')
    idcard_name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='身份证姓名')
    idcard_number = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='身份证号码')
    idcard_front = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='身份证人像面图片')
    idcard_back = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='身份证国微面图片')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SOrderAftersale(db.Model):
    __tablename__ = 's_order_aftersale'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    order_no = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='订单号')
    order_detail_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='订单详情id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    status = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='状态（0待确认, 1待退货, 2待审核, 3已完成, 4已拒绝, 5已取消）')
    type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='业务类型（0仅退款, 1退货退款）')
    refundment = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='退款类型（0原路退回, 1退至钱包, 2手动处理）')
    reason = db.Column(db.String(180), nullable=False, server_default=db.FetchedValue(), info='申请原因')
    number = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='退货数量')
    price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='退款金额')
    msg = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='退款说明')
    images = db.Column(db.Text, info='凭证图片（一维数组json存储）')
    refuse_reason = db.Column(db.String(230), nullable=False, server_default=db.FetchedValue(), info='拒绝原因')
    express_name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='快递名称')
    express_number = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='快递单号')
    apply_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='申请时间')
    confirm_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='确认时间')
    delivery_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='退货时间')
    audit_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='审核时间')
    cancel_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='取消时间')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SOrderCurrency(db.Model):
    __tablename__ = 's_order_currency'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    currency_name = db.Column(db.String(80), nullable=False, index=True, server_default=db.FetchedValue(), info='货币名称')
    currency_code = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='货币代码')
    currency_symbol = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='货币符号')
    currency_rate = db.Column(db.Numeric(7, 6), nullable=False, index=True, server_default=db.FetchedValue(), info='货币汇率')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SOrderDetail(db.Model):
    __tablename__ = 's_order_detail'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    title = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='标题')
    images = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='封面图片')
    original_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='原价')
    price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='价格')
    total_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='当前总价(单价*数量)')
    spec = db.Column(db.Text, info='规格')
    buy_number = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='购买数量')
    model = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='型号')
    spec_weight = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='重量（kg）')
    spec_coding = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='编码')
    spec_barcode = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='条形码')
    refund_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='退款金额')
    returned_quantity = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='退货数量')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SOrderExtractionCode(db.Model):
    __tablename__ = 's_order_extraction_code'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    code = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='取货码')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SOrderFictitiousValue(db.Model):
    __tablename__ = 's_order_fictitious_value'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单id')
    order_detail_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单详情id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    value = db.Column(db.Text, info='虚拟商品展示数据')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SOrderGoodsInventoryLog(db.Model):
    __tablename__ = 's_order_goods_inventory_log'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单id')
    order_detail_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单详情id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    order_status = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单状态（0待确认, 1已确认/待支付, 2已支付/待发货, 3已发货/待收货, 4已完成, 5已取消, 6已关闭）')
    original_inventory = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='原库存')
    new_inventory = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='最新库存')
    is_rollback = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否回滚（0否, 1是）')
    rollback_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='回滚时间')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='创建时间')



class SOrderStatusHistory(db.Model):
    __tablename__ = 's_order_status_history'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    order_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='订单id')
    original_status = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='原始状态')
    new_status = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='最新状态')
    msg = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='操作描述')
    creator = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='创建-用户id')
    creator_name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='创建人-姓名')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='创建时间')



class SPayLog(db.Model):
    __tablename__ = 's_pay_log'

    id = db.Column(db.BigInteger, primary_key=True, info='支付日志id')
    log_no = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='支付日志订单号')
    user_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户id')
    business_type = db.Column(db.String(180), nullable=False, index=True, server_default=db.FetchedValue(), info='业务类型，字符串（如：订单、钱包充值、会员购买、等...）')
    status = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='状态（0待支付, 1已支付, 2已关闭）正常30分钟内未支付将关闭')
    payment = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='支付方式标记')
    payment_name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='支付方式名称')
    subject = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='订单名称')
    total_price = db.Column(db.Numeric(10, 2), nullable=False, index=True, server_default=db.FetchedValue(), info='业务订单金额')
    pay_price = db.Column(db.Numeric(10, 2), nullable=False, index=True, server_default=db.FetchedValue(), info='支付金额')
    trade_no = db.Column(db.String(100), nullable=False, server_default=db.FetchedValue(), info='支付平台交易号')
    buyer_user = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='支付平台用户帐号')
    pay_time = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='支付时间')
    close_time = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='关闭时间')
    add_time = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='添加时间')



class SPayLogValue(db.Model):
    __tablename__ = 's_pay_log_value'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    pay_log_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='支付日志id')
    business_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='业务订单id')
    business_no = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='业务订单号')
    add_time = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='添加时间')



class SPayRequestLog(db.Model):
    __tablename__ = 's_pay_request_log'

    id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    business_type = db.Column(db.String(180), nullable=False, index=True, server_default=db.FetchedValue(), info='业务类型，字符串（如：订单、钱包充值、会员购买、等...）')
    request_params = db.Column(db.String, info='请求参数（数组则json字符串存储）')
    response_data = db.Column(db.String, info='响应参数（数组则json字符串存储）')
    business_handle = db.Column(db.Text, info='业务处理结果（数组则json字符串存储）')
    request_url = db.Column(db.Text, info='请求url地址')
    server_port = db.Column(db.String(10), nullable=False, server_default=db.FetchedValue(), info='端口号')
    server_ip = db.Column(db.String(15), nullable=False, server_default=db.FetchedValue(), info='服务器ip')
    client_ip = db.Column(db.String(15), nullable=False, server_default=db.FetchedValue(), info='客户端ip')
    os = db.Column(db.String(20), nullable=False, server_default=db.FetchedValue(), info='操作系统')
    browser = db.Column(db.String(20), nullable=False, server_default=db.FetchedValue(), info='浏览器')
    method = db.Column(db.String(4), nullable=False, server_default=db.FetchedValue(), info='请求类型')
    scheme = db.Column(db.String(5), nullable=False, server_default=db.FetchedValue(), info='http类型')
    version = db.Column(db.String(5), nullable=False, server_default=db.FetchedValue(), info='http版本')
    client = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='客户端详情信息')
    add_time = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SPayment(db.Model):
    __tablename__ = 's_payment'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    name = db.Column(db.String(30), nullable=False, info='名称')
    payment = db.Column(db.String(60), nullable=False, unique=True, server_default=db.FetchedValue(), info='唯一标记')
    logo = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='logo')
    version = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='插件版本')
    apply_version = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='适用系统版本')
    desc = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='插件描述')
    author = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='作者')
    author_url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='作者主页')
    element = db.Column(db.Text, info='配置项规则')
    config = db.Column(db.Text, info='配置数据')
    apply_terminal = db.Column(db.String(255), nullable=False, info='适用终端 php一维数组json字符串存储（pc, h5, ios, android, alipay, weixin, baidu, toutiao, qq）')
    apply_terminal_old = db.Column(db.String(255), nullable=False, info='原始适用终端 php一维数组json字符串存储（pc, h5, ios, android, alipay, weixin, baidu, toutiao, qq）')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    is_open_user = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否对用户开放')
    sort = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='顺序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SPlugin(db.Model):
    __tablename__ = 's_plugins'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    plugins = db.Column(db.String(60), nullable=False, unique=True, server_default=db.FetchedValue(), info='唯一标记')
    data = db.Column(db.String, info='应用数据')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SPluginsFreightfeeTemplate(db.Model):
    __tablename__ = 's_plugins_freightfee_template'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    warehouse_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='仓库id')
    show_name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='展示名称')
    payment = db.Column(db.Text, info='免运费支付方式(英文逗号分割存储)')
    goods_ids = db.Column(db.Text, info='免运费商品(英文逗号分割存储)')
    valuation = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='计价方式（0按件数, 1按重量）')
    is_insufficient_first_price = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='首(件/重)不满足按首费计算(默认0, 0否, 1是)')
    is_continue_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='续费计算方式(默认0, 0四舍五入取整, 1向上取整（有小数就加1）, 2向下取整（有小数就忽略、直接取整）)')
    data = db.Column(db.Text, info='运费模板规则(json存储)')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SPower(db.Model):
    __tablename__ = 's_power'

    id = db.Column(db.Integer, primary_key=True, info='权限id')
    pid = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='权限父级id')
    name = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='权限名称')
    control = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='控制器名称')
    action = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='方法名称')
    url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='自定义url地址')
    sort = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='排序')
    is_show = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否显示（0否，1是）')
    icon = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='图标class')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SQuickNav(db.Model):
    __tablename__ = 's_quick_nav'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    platform = db.Column(db.String(30), nullable=False, index=True, server_default=db.FetchedValue(), info='所属平台（pc PC网站, h5 H5手机网站, ios 苹果APP, android 安卓APP, alipay 支付宝小程序, weixin 微信小程序, baidu 百度小程序, toutiao 头条小程序, qq QQ小程序）')
    event_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='事件类型（0 WEB页面, 1 内部页面(小程序或APP内部地址), 2 外部小程序(同一个主体下的小程序appid), 3 打开地图, 4 拨打电话）')
    event_value = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='事件值')
    images_url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='图片地址')
    name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='名称')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    bg_color = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='css背景色值')
    sort = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='排序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SRefundLog(db.Model):
    __tablename__ = 's_refund_log'

    id = db.Column(db.BigInteger, primary_key=True, info='退款日志id')
    user_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户id')
    business_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='业务订单id')
    business_type = db.Column(db.String(180), nullable=False, index=True, server_default=db.FetchedValue(), info='业务类型，字符串（如：订单、钱包充值、会员购买、等...）')
    trade_no = db.Column(db.String(100), nullable=False, server_default=db.FetchedValue(), info='支付平台交易号')
    buyer_user = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='支付平台用户帐号')
    refund_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='退款金额')
    pay_price = db.Column(db.Numeric(10, 2), nullable=False, server_default=db.FetchedValue(), info='订单实际支付金额')
    msg = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='描述')
    payment = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='支付方式标记')
    payment_name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='支付方式名称')
    refundment = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='退款类型（0原路退回, 1退至钱包, 2手动处理）')
    return_params = db.Column(db.Text, info='支付平台返回参数（以json存储）')
    add_time = db.Column(db.Integer, nullable=False, info='添加时间')



class SRegion(db.Model):
    __tablename__ = 's_region'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    pid = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='父id')
    name = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='名称')
    level = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='级别类型（1:一级[所有省], 2：二级[所有市], 3:三级[所有区县], 4:街道[所有街道]）')
    letters = db.Column(db.String(3), nullable=False, server_default=db.FetchedValue(), info='城市首字母')
    sort = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='排序')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SRole(db.Model):
    __tablename__ = 's_role'

    id = db.Column(db.Integer, primary_key=True, info='角色组id')
    name = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='角色名称')
    is_enable = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SRolePower(db.Model):
    __tablename__ = 's_role_power'

    id = db.Column(db.Integer, primary_key=True, info='关联id')
    role_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='角色id')
    power_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='权限id')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SScreeningPrice(db.Model):
    __tablename__ = 's_screening_price'

    id = db.Column(db.Integer, primary_key=True, info='分类id')
    pid = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='父id')
    name = db.Column(db.String(30), nullable=False, info='名称')
    min_price = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='最小价格')
    max_price = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='最大价格')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    sort = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='顺序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SSearchHistory(db.Model):
    __tablename__ = 's_search_history'

    id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    user_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户id')
    brand_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='品牌id')
    category_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='分类id')
    keywords = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='搜索关键字')
    screening_price = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='搜索价格区间')
    order_by_field = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='排序类型（字段名称）')
    order_by_type = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='排序方式（asc, desc）')
    ymd = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='日期 ymd')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SSlide(db.Model):
    __tablename__ = 's_slide'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    platform = db.Column(db.String(30), nullable=False, index=True, server_default=db.FetchedValue(), info='所属平台（pc PC网站, h5 H5手机网站, ios 苹果APP, android 安卓APP, alipay 支付宝小程序, weixin 微信小程序, baidu 百度小程序, toutiao 头条小程序, qq QQ小程序）')
    event_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='事件类型（0 WEB页面, 1 内部页面(小程序或APP内部地址), 2 外部小程序(同一个主体下的小程序appid), 3 打开地图, 4 拨打电话）')
    event_value = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='事件值')
    images_url = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='图片地址')
    name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='名称')
    bg_color = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='css背景色值')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    sort = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='排序')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SUser(db.Model):
    __tablename__ = 's_user'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    alipay_openid = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='支付宝openid')
    weixin_openid = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='微信openid')
    weixin_unionid = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='微信unionid')
    weixin_web_openid = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='微信web用户openid')
    baidu_openid = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='百度openid')
    toutiao_openid = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='百度openid')
    qq_openid = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='QQopenid')
    qq_unionid = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='QQunionid')
    status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='状态（0正常, 1禁止发言, 2禁止登录）')
    salt = db.Column(db.String(32), nullable=False, server_default=db.FetchedValue(), info='配合密码加密串')
    pwd = db.Column(db.String(32), nullable=False, server_default=db.FetchedValue(), info='登录密码')
    token = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='token')
    username = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='用户名')
    nickname = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='用户昵称')
    mobile = db.Column(db.String(11), nullable=False, index=True, server_default=db.FetchedValue(), info='手机号码')
    email = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='电子邮箱（最大长度60个字符）')
    gender = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='性别（0保密，1女，2男）')
    avatar = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='用户头像地址')
    province = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='所在省')
    city = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='所在市')
    birthday = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='生日')
    address = db.Column(db.String(150), nullable=False, server_default=db.FetchedValue(), info='详细地址')
    integral = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='有效积分')
    locking_integral = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='锁定积分')
    referrer = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='推荐人用户id')
    is_delete_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否已删除（0否, 大于0删除时间）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SUserAddres(db.Model):
    __tablename__ = 's_user_address'

    id = db.Column(db.Integer, primary_key=True, info='站点id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='站点所属用户id')
    alias = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='别名')
    name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='姓名')
    tel = db.Column(db.String(15), nullable=False, server_default=db.FetchedValue(), info='电话')
    province = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='所在省')
    city = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='所在市')
    county = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='所在县/区')
    address = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='详细地址')
    lng = db.Column(db.Numeric(13, 10), nullable=False, server_default=db.FetchedValue(), info='经度')
    lat = db.Column(db.Numeric(13, 10), nullable=False, server_default=db.FetchedValue(), info='纬度')
    idcard_name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='身份证姓名')
    idcard_number = db.Column(db.String(30), nullable=False, server_default=db.FetchedValue(), info='身份证号码')
    idcard_front = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='身份证人像面图片')
    idcard_back = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='身份证国微面图片')
    is_default = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='是否默认地址（0否, 1是）')
    is_delete_time = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否删除（0否，1删除时间戳）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SUserIntegralLog(db.Model):
    __tablename__ = 's_user_integral_log'

    id = db.Column(db.BigInteger, primary_key=True, info='自增id')
    user_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='用户id')
    type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='操作类型（0减少, 1增加）')
    original_integral = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='原始积分')
    new_integral = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='最新积分')
    operation_integral = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='操作积分')
    msg = db.Column(db.String(255), server_default=db.FetchedValue(), info='操作原因')
    operation_id = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='操作人员id')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class SWarehouse(db.Model):
    __tablename__ = 's_warehouse'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    name = db.Column(db.String(60), nullable=False, index=True, server_default=db.FetchedValue(), info='名称')
    alias = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='别名')
    level = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='权重（数字越大权重越高）')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    contacts_name = db.Column(db.String(60), nullable=False, server_default=db.FetchedValue(), info='联系人姓名')
    contacts_tel = db.Column(db.String(15), nullable=False, server_default=db.FetchedValue(), info='联系电话')
    province = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='所在省')
    city = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='所在市')
    county = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='所在县/区')
    address = db.Column(db.String(80), nullable=False, server_default=db.FetchedValue(), info='详细地址')
    lng = db.Column(db.Numeric(13, 10), nullable=False, server_default=db.FetchedValue(), info='经度')
    lat = db.Column(db.Numeric(13, 10), nullable=False, server_default=db.FetchedValue(), info='纬度')
    is_default = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否默认（0否, 1是）')
    is_delete_time = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否删除（0否，大于0删除时间戳）')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SWarehouseGood(db.Model):
    __tablename__ = 's_warehouse_goods'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    warehouse_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='仓库id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    is_enable = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='是否启用（0否，1是）')
    inventory = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='总库存')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')
    upd_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='更新时间')



class SWarehouseGoodsSpec(db.Model):
    __tablename__ = 's_warehouse_goods_spec'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    warehouse_goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='仓库商品id')
    warehouse_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='仓库id')
    goods_id = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='商品id')
    md5_key = db.Column(db.String(32), nullable=False, index=True, server_default=db.FetchedValue(), info='md5key值')
    spec = db.Column(db.Text, info='规格值')
    inventory = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='库存')
    add_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='添加时间')



class Ticket(db.Model):
    __tablename__ = 'ticket'

    userid = db.Column(db.String(255), nullable=False)
    ticketnum = db.Column(db.String(259), primary_key=True, info='彩票号码')
    activid = db.Column(db.Integer, info='活动id')
    iswin = db.Column(db.String(255), info='是否中奖')
    giftid = db.Column(db.Integer, info='奖品id')
